-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resharding: cleanup #585
resharding: cleanup #585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
neps/nep-0568.md
Outdated
Since [Stateless Validation][NEP-508], all shards tracking is no longer required. Currently, shard cleanup has not been implemented. We propose a cleanup mechanism that will also handle post-resharding cleanup. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you define briefly what is state cleanup and under what circumstances it is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 333544c
neps/nep-0568.md
Outdated
|
||
Since [Stateless Validation][NEP-508], all shards tracking is no longer required. Currently, shard cleanup has not been implemented. We propose a cleanup mechanism that will also handle post-resharding cleanup. | ||
|
||
When garbage collection removes the last block of an epoch from the canonical chain, we determine which shards were tracked during that epoch by examining the shards present in `TrieChanges` at that block. Similarly, we collect information on shards tracked in subsequent epochs, up to the present one. A shard State is removed only if: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: two spaces between "collect" and "information"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 333544c
neps/nep-0568.md
Outdated
|
||
#### Negative refcounts | ||
|
||
Some trie keys (e.g. `TrieKey::DelayedReceipt`) are shared among child shards, but their corresponding State is not duplicated. The `DBCol::State` column uses reference counting, meaning some data is counted only once, despite being referenced by multiple child shards. This can result in negative refcounts when the data is later removed. To mitigate this, we modify the RocksDB `refcount_merge` behavior so that negative refcounts are clamped to 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mention that this is sub-optimal, why, and that we should follow up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 333544c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
neps/nep-0568.md
Outdated
@@ -112,6 +112,22 @@ Cold storage uses the same mapping strategy to manage shard state during reshard | |||
|
|||
This approach minimizes complexity while maintaining consistency across hot and cold storage. | |||
|
|||
#### State cleanup | |||
|
|||
Since [Stateless Validation][NEP-508], all shards tracking is no longer required. Currently, shard cleanup (e.g. when we stopped tracking one shard and started tracking another shard) has not been implemented. With resharding, we would also want to cleanup parent shard once we stop tracking all its descendants. We propose a shard cleanup mechanism that will also handle post-resharding cleanup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't stateless validation NEP-509?
No description provided.